package com.zftlive.android.sample.scrollview;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import android.view.View;

import com.zftlive.android.R;
import com.zftlive.android.library.base.BaseActivity;
import com.zftlive.android.library.common.ActionBarManager;
import com.zftlive.android.library.widget.SListView;
import com.zftlive.android.library.widget.scrollview.PullScrollView;

/**
 * Pull down ScrollView @link https://github.com/MarkMjw/PullScrollView
 * 
 * @author 曾繁添
 * @version 1.0
 */
public class PulldownViewActivity extends BaseActivity implements
		PullScrollView.OnTurnListener {
	private PullScrollView mScrollView;
	private View mHead;
	/** 产品信息列表 **/
	private SListView lv_zc_product_list;

	@Override
	public int bindLayout() {
		return R.layout.activity_pull_down_scrollview;
	}
	
	@Override
	public View bindView() {
		return null;
	}

	@Override
	public void initParms(Bundle parms) {
		
	}
	
	@SuppressLint("NewApi")
	@Override
	public void initView(View view) {
		mScrollView = (PullScrollView) findViewById(R.id.scroll_view);
		
		mHead = getLayoutInflater().inflate(R.layout.activity_listivew_head, null);
		
		lv_zc_product_list = (SListView) findViewById(R.id.lv_zc_product_list);
		lv_zc_product_list.addHeaderView(mHead);
		lv_zc_product_list.setAdapter(new ProductListAdapter(getContext()));
//		lv_zc_product_list.setOnTouchListener(new View.OnTouchListener() {
//			
//			@Override
//			public boolean onTouch(View v, MotionEvent event) {
//				 switch (event.getAction()) {
//	                case MotionEvent.ACTION_MOVE:
//	                       
//	                        return true ;
//	                default:
//	                        break;
//	                }
//	                return onTouchEvent(event);
//			}
//		});
		
		mScrollView.setHeader(lv_zc_product_list);
		mScrollView.setOnTurnListener(this);
		mScrollView.setScrollRatio(0.3f);//设置阻尼系数  
		
        //初始化带返回按钮的标题栏
  		ActionBarManager.initBackTitle(this, getActionBar(), this.getClass().getSimpleName());  
	}

	@Override
	public void doBusiness(Context mContext) {
		
	}

	/**
	 * 翻转事件监听器
	 */
	@Override
	public void onTurn() {

	}

	@Override
	public void resume() {

	}

	@Override
	public void destroy() {

	}

}
